unit dExcept;

interface

 uses
  Classes,
  StrUtils,
  SysUtils;

  type
  EDuallError = class(Exception)
   private
    FErrorCode: Integer;
    FStatusCode: String;
   protected
   public
   constructor Create(const ErrorCode: Integer;
  const Msg: array of string);
   constructor CreateClone(const E:EDuallError);
   property ErrorCode : Integer read FErrorCode write FErrorCode;
   property StatusCode  : String  read FStatusCode write FStatusCode;
   end; 

   EDBError = class(EDuallError);
   EPDVError = class(EDuallError);

implementation

{ EDuallError }

constructor EDuallError.Create(const ErrorCode: Integer;
  const Msg: array of string);
  var
   FMsgString : String;
   i : Integer;
begin
  FMsgString := '';
  for i := Low( Msg ) to High( Msg ) do
  begin
   if (I = 0) then
   begin
    FMsgString :=  FMsgString + '' + Msg[i];
   end
   else
     FMsgString :=  FMsgString + sLineBreak + Msg[i];
  end;

  FErrorCode  := ErrorCode;
  FStatusCode := '';
  inherited Create( FMsgString );
end;

constructor EDuallError.CreateClone(const E: EDuallError);
begin
 FErrorCode  :=E.ErrorCode;
 FStatusCode :=E.Statuscode;
 inherited Create( E.Message );
 end; 
end.
